<?php
/**
 * 资产包——审核情况
 * User: zhao shou qiang
 * Date: 2018\01\19
 * Time: 15:45
 */

use yii\helpers\Html;
use yii\helpers\Url;
use backend\assets\AppAsset;
use backend\controllers\DtActionFilter;

$this->title = '资产包日志';
$this->registerCssFile('@web/css/index.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/mask.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/AssetPackageDetails.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/notEdit.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/paging.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/select2.min.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/defaultTheme.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);


$this->registerCss('  
    .wrap > .container-fluid > .container{width: 100%; padding: 0; margin: 0; }
    .edit-tabs{top: 10px;}
    .container.content.content2{top: 0;}
    .wrap{margin: 0;}  

    #page_list{margin-left : 30%;}
    #page_list .pagination{margin: 0;} 
');

AppAsset::addScript($this, '@web/js/packageLog.js');

$avatar = $data['avatar'];
$editFlag = $data['avatar']['editFlag'];
?>

<?php echo $this->render('header', ['data' => $data, 'isPlan' => $isPlan, 'editFlag' => $editFlag, 'workflow_status'=>$workflow_status,'result'=>$result]); ?>


<style type="text/css">
	
	.txt-cut {
	    overflow: hidden;
	    text-overflow: ellipsis;
	    display: -webkit-box;
	    -webkit-line-clamp: 1;
	    -webkit-box-orient: vertical;
	}
    .toTop{position: fixed;  bottom: 7%; right: 2%; z-index: 99;}
     table tr:hover{
    	background: #e8f4fe;
    }
    
    .border {
      border-left: 1px solid #2194f1!important;
    }
    table.donot-edit tr th, table.donot-edit tr td {
    	 padding-left: 0px; 
    	 height: 40px;
	}
	 table.donot-edit tr th:first-child {
    	 width: 10%;
	}
	table.donot-edit tr th:nth-child(2) {
      width: 20%;
	}
	table.donot-edit tr th:nth-child(3) {
      width: 30%;
	}
	 table.donot-edit tr th:last-child {
      width: 40%;
	}
	
	.maintenance .table tr td {
    	line-height: 22px;
	}
	
	.pb100 {
		padding-bottom: 10px!important;
	}
	
	#czrz2 .pagingBox{
	 	text-align: center;
	 }
	 

	 #czrz2 .pagingBox #page_list{
	 	margin-left: 0px;
	 }
	 
	 .mb10 {
     margin-bottom: 0px!important; 
	}
	.pb40 {
	    padding-bottom: 24px!important;
	}
</style>

<!-- 一键置顶开始 -->
<div class="toTop">
    <img src="/image/common/clickTop.png">
</div>
<!-- 一键置顶结束 -->

<script type="text/javascript">
    // 一键置顶 点击
    $('.toTop').click(function() {
        $("html,body").animate({ scrollTop: 0 }, 100);
    });
</script>


<div class="modal fade" id="AssetPackageEditing-approval" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel">
</div>
<!-- 页内导航   开始-->
<div class="container edit-tabs">
    <div class="row">
        <ul class="edit-tabs-ul1">
            <li class="pull-left edit-tabs-li1 jbqk" data-title="packageDetail">
                <a href="<?php
                echo Url::toRoute(['package/detail-info', 'packageid' => $data['id']]);
                ?>">基本情况</a>
                <ul class="edit-tabs-ul2 " style="display: none;">
                    <li class="pull-left active" id="jbqk1-link"><a href="###">基本信息</a></li>
                    <li class="pull-left " id="jbqk2-link"><a href="###">转让信息</a></li>
                    <li class="pull-left " id="jbqk3-link"><a href="###">流转、前期处置及维护情况</a></li>
                    <li class="pull-left " id="jbqk4-link"><a href="###">项目清单</a></li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1 jdpg">
                <a href="<?php
                echo Url::toRoute(['package/initiation', 'packageid' => $data['id']]);
                ?>">立项评估</a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left active" id="jdpg1-link"><a href="###">立项信息</a></li>
                    <li class="pull-left " id="jdpg6-link"><a href="###">报价信息</a></li> <!-- unclick -->
                    <li class="pull-left " id="jdpg2-link"><a href="###">团队组成</a></li>
                    <li class="pull-left " id="jdpg3-link"><a href="###">工作计划</a></li>
                    <li class="pull-left " id="jdpg4-link"><a href="###">团队受益分配</a></li>
                    <li class="pull-left " id="jdpg5-link"><a href="###">其他</a></li>
                </ul>
            </li>
            <li class="pull-left edit-tabs-li1 shqk">
                <a href="<?php
                echo Url::toRoute(['package/audit-feedback', 'packageid' => $data['id']]);
                ?>">审核情况</a>
                <ul class="edit-tabs-ul2" style="display: none;">
                    <li class="pull-left active"><a href="###">审核状况</a></li>
                </ul>
            </li>
            <li class="pull-left active edit-tabs-li1 czrz" data-title="packageLog">
                <!--                <a href="--><?php
                //                echo Url::toRoute(['package/log', 'packageid' => $data['id']]);
                //                ?><!--">操作日志</a>-->
                操作日志
                <ul class="edit-tabs-ul2 " style="display: block;">
                    <li class="pull-left active" id="czrz1-link"><a href="###">操作记录</a></li>
                    <li class="pull-left " id="czrz2-link"><a href="###">数据更新纪录</a></li>
                </ul>
            </li>
        </ul>
    </div>
</div>
<!-- 页内导航   结束-->

<!-- 日志  开始 -->
<div class="container-fluid AssetPackageDetails OperationLog">
    <div class="container content content2">
        <div class="row package_log">
            <div class="content-right pull-right  col-md-12">
                <!-- 资产包操作日志  开始  -->
                <div class="maintenance row mb10 pb100" id="czrz1">
                    <div class="perfect-logo clearfix">
                        <img src="/image/officeHall/uploadAssetPackage/wsxx.png" class="pull-left">
                        <span class="pull-left">资产包日志</span>
                    </div>
                    <div class="table-responsive pull-left table-responsive2">
                        <table class="table donot-edit">
                            <thead>
                            <tr>
                                <th class="text-center">序号</th>
                                <th class="text-left">操作时间</th>
                                <th class="text-left">操作人</th>
                                <th class="text-left">操作内容</th>
                            </tr>
                            </thead>
                            <tbody class="maintenance-tbody">
                            <?php if (!empty($dataLog['packageLogs']) && is_array($dataLog['packageLogs'])) { ?>
                                <?php
                                $i = 1;
                                foreach ($dataLog['packageLogs'] as $value) { ?>
                                    <tr>
                                        <td class="text-center">
                                            <?php /*echo Html::encode($value['id']); */?>
                                            <?php echo $i++; ?>
                                        </td>
                                        <td class="text-left"><?php echo Html::encode($value['created_at']); ?></td>
                                        <td>
                                        	<span class="txt-cut"><?php echo Html::encode($value['user_id']); ?></span>
                                        </td>
                                        <td>
                                                <!--<span title="<?php /*echo Html::encode($value['log']); */?>">
                                                     <?php /*echo Html::encode($value['log2']); */?>
                                                </span>-->
                                                
                                            <span class="txt-cut">
                                                <?php echo Html::encode($value['log']); ?>
                                            </span>
                                        </td>
                                    </tr>
                                <?php } ?>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- 资产包操作日志   结束 -->

                <!-- 数据更新记录  开始  -->
                <div class="maintenance row mb10 pb40 clearfix" id="czrz2">
                    <!-- <img src="image/assetPackage/edit.png" class="edit-img"> -->
                    <div class="perfect-logo clearfix">
                        <img src="/image/officeHall/uploadAssetPackage/wsxx.png" class="pull-left">
                        <span class="pull-left">数据更新记录</span>
                        <select class="pull-right" name="user">
                            <?php if (!empty($dataLog['packageUpdateLogUsers']) && is_array($dataLog['packageUpdateLogUsers'])) { ?>
                                <?php
                                foreach ($dataLog['packageUpdateLogUsers'] as $k => $v) {
                                    echo "<option value='{$k}' >{$v}</option>";
                                }
                                ?>
                            <?php } ?>
                            <option value="0" selected>操作人</option>
                        </select>
                        <select class="pull-right" name="module">
                            <?php if (!empty($dataLog['modules']) && is_array($dataLog['modules'])) { ?>
                                <?php
                                foreach ($dataLog['modules'] as $k => $v) {
                                    echo "<option value='{$k}' >{$v}</option>";
                                }
                                ?>
                            <?php } ?>
                            <option value="0" selected>所属模块</option>
                        </select>
                        <select class="pull-right" name="date">
                            <option value="1">一周内</option>
                            <option value="2" selected="selected">一个月内</option>
                            <option value="3">一个月前</option>
                        </select>
                    </div>

                    <div class="table-responsive  table-responsive2 clearfix">
                        <table class="table donot-edit">
                            <thead>
                            <tr>
                                <th class="text-center">序号</th>
                                <th class="text-left">操作时间</th>
                                <th class="text-left">操作人</th>
                                <th class="text-left">所属模块</th>
                                <th class="text-left">操作内容</th>
                            </tr>
                            </thead>
                            <tbody class="maintenance-tbody" id="page_list_tr">
                            <?php if (!empty($dataLog['packageUpdateLogs']) && is_array($dataLog['packageUpdateLogs'])) { ?>
                                <?php
                                $j = 1;
                                foreach ($dataLog['packageUpdateLogs'] as $key => $value) { ?>
                                    <tr>
                                        <td class="text-center"
                                            style="width: 10%;">
                                            <?php /*echo Html::encode($value['id']); */?>
                                            <?php echo $j++; ?>
                                        </td>
                                        <td class=""
                                            style="width: 15%;"><?php echo Html::encode($value['created_at']); ?></td>
                                        <td style="width: 10%;">
                                        	<span class="txt-cut"><?php echo Html::encode($value['user_id']); ?></span>
                                        </td>
                                        <td style="width: 15%;">
                                        	<span class="txt-cut"><?php echo Html::encode($value['module']); ?></span>
                                        </td>
                                        <td style="width: 40%;">
                                                <span class="txt-cut" title="<?php echo Html::encode($value['log']); ?>"><?php echo Html::encode($value['log2']); ?></span>
                                        </td>
                                    </tr>
                                <?php } ?>
                            <?php }else { ?>
                                <tr style="height: 51px;">
                                    <td class="text-center" style="width: 10%;"></td>
                                    <td class="" style="width: 10%;"></td>
                                    <td style="width: 15%;"></td>
                                    <td style="width: 15%;"></td>
                                    <td style="width: 40%;"><span title=""></span></td>
                                </tr>
                                <tr style="height: 51px;">
                                    <td class="text-center" style="width: 10%;"></td>
                                    <td class="text-center" style="width: 10%;"></td>
                                    <td style="width: 15%;"></td>
                                    <td style="width: 15%;"></td>
                                    <td style="width: 40%;"><span title=""></span></td>
                                </tr>
                            <?php } ?>

                            </tbody>
                        </table>
                    </div>

                    <div class="pagingBox" style="display: <?php if(!empty($dataLog['packageUpdateLogs'])) echo 'block'; else echo 'none'; ?>;">
                        <div class="" id="page_list">
                            <?php echo $dataLog['linkPager']; ?>
                        </div>
                        <div class=" pull-right" style="margin-top: -28px;">
                            <span class="pageTotal">
                                <span class="pageT"></span> 每页
                                <a id="list">
                                    <span class="number" style="color:#2194f1;">10</span>
                                    <ul class="pageTotalBox">
                                        <li class="pageActive">10</li>
                                        <li>20</li>
                                        <li>30</li>
                                        <li>40</li>
                                        <li>50</li>
                                    </ul>
                                </a>
                                <b class="caret"></b>行
                            </span>
                            共<span class="totalSize" style="color:#2194f1;"><?php echo $dataLog['count']; ?></span>&nbsp;&nbsp;条记录
                        </div>
                    </div>
                </div>
                <!-- 数据更新记录  结束  -->
            </div>
        </div>
    </div>
</div>
<!-- 日志结束 -->

<input type="hidden" id="package_id" name="package_id" value="<?php echo $data['id']; ?>">
<input type="hidden" id="log_pager" name="log_pager"
       value="<?php echo \yii\helpers\Url::toRoute('package-log/page2', true); ?>">
<input type="hidden" id="current_page" value="<?php echo $dataLog['page']; ?>">
<input type="hidden" id="base_url" value="<?php echo Yii::$app->request->hostInfo; ?>">


<!-- 4.模态窗口    开始  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<input type="hidden" class="btn btn-primary btn-lg modal_log_show" data-toggle="modal"
       data-target="#AssetPackageEditing-approval-log"/>
<!-- Modal -->
<div class="modal fade" id="AssetPackageEditing-approval-log" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true"><img src="/image/assetPackage/close.png"></span></button>
                <div class="pull-left modal-nav">
                    <img src="/image/assetPackage/white.png" class="pull-left">
                    <span class="pull-left">操作内容</span>
                </div>
            </div>
            <div class="modal-body-approval">
                <div class="modal-body-approval-div">
                    <pre style="font-size: 14px; font-family: 'Microsoft YaHei', Tahoma, Arial;background: #fff;color: #333;border: none;">
                        数据更新记录操作详情
                    </pre>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-primary btns-primary modal_log_btn">确定</button>
            </div>
        </div>
    </div>
</div>
<!-- 模态窗口  结束!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

<?php echo $this->render('footer', ['data' => $data]); ?>
<script type="text/javascript">
    $(".OperationLog").css({
        'margin-top' : '10px'
    });
    // 1 尽调评估 -立项信息
    $("#czrz1-link").click(function() {
        if (!$(this).hasClass("unclick")) {
            // $(this).addClass("active").siblings().removeClass("active");
            $("#czrz1-link").parent().find("li").removeClass("active");
            $("#czrz1-link").addClass("active");
             $("html, body").animate({scrollTop: $("#czrz1").offset().top - 110 }, {duration: 1,easing: "swing"});
            return false;
        }
    });
    // 2.尽调评估- 团队组成
    $("#czrz2-link").click(function() {
        if (!$(this).hasClass("unclick")) {
            $("#czrz2-link").parent().find("li").removeClass("active");
            $("#czrz2-link").addClass("active");
             $("html, body").animate({scrollTop: $("#czrz2").offset().top - 110 }, {duration: 1,easing: "swing"});
            return false;
        }
    }); 
    //滚动条滚动到指定位置触发下面事件
    var czrz1 = $("#czrz1");
    var offSetczrz1 = czrz1.offset().top - 110;
    var czrz2 = $("#czrz2");
    var offSetczrz2 = czrz2.offset().top - 110;
    $(window).scroll(function(){
        if ($(window).scrollTop() >= offSetczrz1 &&  $(window).scrollTop() < offSetczrz2){
            $("#czrz1-link").addClass("active").siblings("li").removeClass("active");
        }else if ($(window).scrollTop() >= offSetczrz2 ){
            $("#czrz2-link").addClass("active").siblings("li").removeClass("active");
        }
    });
</script>
